//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Windows;


namespace OpenLS.Spreadsheet.UI
{
    class InternalDataObject
    {
        readonly Dictionary<string, object> table = new Dictionary<string, object>();
        internal InternalDataObject(IDataObject obj)
        {
            foreach (string s in obj.GetFormats())
                SetData(s, obj.GetData(s));
        }

        public InternalDataObject(string format, object data)
        {
            SetData(format, data);
        }
        #region IDataObject Members

        public object GetData(Type format)
        {
            return GetData(format.ToString());
        }

        public object GetData(string format)
        {
            return table[format];
        }

        public object GetData(string format, bool autoConvert)
        {
            return GetData(format);
        }

        public bool GetDataPresent(Type format)
        {
            return GetDataPresent(format.ToString());
        }

        public bool GetDataPresent(string format)
        {
            return table.ContainsKey(format);
        }

        public bool GetDataPresent(string format, bool autoConvert)
        {
            return table.ContainsKey(format);
        }

        public string[] GetFormats()
        {
            List<string> l = new List<string>(table.Keys);
            return l.ToArray();
        }

        public string[] GetFormats(bool autoConvert)
        {
            return GetFormats();
        }

        public void SetData(object data)
        {
            
        }

        public void SetData(Type format, object data)
        {
            SetData("", data);
        }

        public void SetData(string format, object data)
        {
            table.Add(format, data);
        }

        public void SetData(string format, bool autoConvert, object data)
        {
            SetData(format, data);
        }

        #endregion

        #region IDataObject Members


        public void SetData(string format, object data, bool autoConvert)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
